typedef unsigned char BYTE;
typedef struct{
	int segno;  /* segment number */
	BYTE *start;  /* segment first Byte pos */
	BYTE *end;    /* segment last Byte pos */
}t_segment;


void* open_file(char *filename, size_t *pFSize);
t_segment *split_file(BYTE *start, size_t fsize, int segnum);

void* parseSeg(t_segment *pSeg);
unsigned int cal_crc(unsigned char *ptr);
int insert_key(int segno, unsigned int key, char *data);

#define atomic_lock(_LOCK_)  while (!__sync_bool_compare_and_swap(_LOCK_, 0, 1));
#define atomic_unlock(_LOCK_)  while(!__sync_bool_compare_and_swap(_LOCK_, 1, 0));

#define PRINTF 

#define SEGNUM 16
